﻿

namespace Tentacle.Node
{
    using System;
    using System.Net;
    using Tentacle.Downloader;


    class Program
    {
        static void Main(string[] args)
        {
            RemoteWork worker = new RemoteWork();
            worker.SetSite += OnSetToken;
            Console.WriteLine($"Worker 正在工作");
            foreach(var ip in worker.LocalEndPoint) {
                Console.WriteLine($"[worker]  {DateTime.Now}  {ip}");
            }
            while (true) {
                var msg = Console.ReadLine();
                if(msg.ToLower() == "proxy") {
                    var proxy = Console.ReadLine();
                    worker.Proxy = new WebProxy(proxy);
                }
            }
        }

        private static void OnSetToken(string site)
        {
            Console.WriteLine($"[task]  {DateTime.Now}  {site}");
        }
    }
}
